package com.invest.infra.excel.wrapper;

import com.invest.infra.excel.wrapper.impl.ExWorkbookImpl;
import org.apache.poi.ss.usermodel.Workbook;
import org.apache.poi.ss.usermodel.WorkbookFactory;

import java.io.InputStream;

public class ExWorkbookFactory {
	
	public static ExWorkbook instance(InputStream in,String fileName) {
		ExWorkbook book = null;
		Workbook poiWork = null;
		try { 
			poiWork = WorkbookFactory.create(in);
			if(poiWork != null){
				book = ExWorkbookImpl.instance(poiWork,fileName);
			}
		} catch (Exception e) {
			throw new RuntimeException(e);
		} 
		return book;
	}
}
